package com.example.springbootapplication;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.Collections;
import java.util.Set;

/**
 *
 */

public class SpringApplicationBootstrap {

	public static void main(String[] args) {
		Set<String> emptySet = Collections.singleton(ApplicationConfiguration.class.getName());
		//配置Bean 的class名称
		SpringApplication springApplication = new SpringApplication();
		//这是Bean源
		springApplication.setSources(emptySet);
		//这是web类型
		springApplication.setWebApplicationType(WebApplicationType.NONE);
		ConfigurableApplicationContext applicationContext = springApplication.run(args);
		ApplicationConfiguration contextBean = applicationContext.getBean(ApplicationConfiguration.class);
		System.out.println("bean :"+contextBean);
	}

	@SpringBootApplication
	public static class ApplicationConfiguration{

	}
}
